/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package stage;

import model.StageMapped;
import webserviceStage.ArrayOfSportsTraining;
import webserviceStage.SportsTraining;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Lionel
 */
public class StageManager {

    public static List<StageMapped> GetStageList (){
        List<StageMapped> listStage = new ArrayList<StageMapped>();
        ArrayOfSportsTraining StageWebservice = getAllStage();
        for (SportsTraining Stagews : StageWebservice.getSportsTraining()) {
            StageMapped tmp = new StageMapped(Stagews.getSportstrainingID(), Stagews.getDescription().getValue(), Stagews.getDuration(), Stagews.getLabel().getValue(),Stagews.getLevel(),Stagews.getMinAge(),Stagews.getPrice().toBigInteger().doubleValue(),Stagews.getRegistrationDeadLine().toString(),Stagews.getRegistrationMax(),Stagews.getRegistrationCount(),Stagews.getStartDate().toString());

            listStage.add(tmp);
        }
        return listStage;
    }

    private static ArrayOfSportsTraining getAllStage() {
        webserviceStage.Stage service = new webserviceStage.Stage();
        webserviceStage.IWSStage port = service.getBasicHttpBindingIWSStage();
        return port.getAllStage();
    }

  

   

   
}
